POV-Ray : Newsgroups : povray.advanced-users : Math help needed please. : Re: Math help needed please. Server Time
30 Jul 2024 22:26:05 EDT (-0400)
  Re: Math help needed please.  
From: Josh English
Date: 19 Apr 1999 20:52:37
Message: <371BC172.F6F8B0AC@spiritone.com>
Thank you for the circumference formula... I've been looking for it.

Here's the logic I've been applying:
1: create the unit sphere at the origin,
2: scale
3: rotate around z axis
4: translate against the y axis
5: translate against the x axis

steps 1,2, and 3 are easy. Step 4 is giving me headaches.

I've been playing with this code:

#declare x_scale = 0.25;
#declare y_scale = 1;

#declare rotation=60; // this can be anything, it's the control variable
#declare roff = 0 // or 90 or radians(90)

#declare centerX = cos(rotation-roff)*x_scale; // these should give us the x/y
values
#declare centerY = sin(rotation-roff)*y_scale; // of the edge of the sphere (z
axis)

#declare height=vlength(<centerX,centerY,0>);

This should give us the length from the edge of the sphere to the center (again
on the z axis, where the sphere
is biggest) and since the sphere is centered around the origin, simply
translate*height*y.

Of course, there is a basic flaw in this logic... The point that I'm measuring
to on the edge of the sphere is being rotated around the z axis.  I haven't
found a way out of this trap yet. It looks like it should work... so what am I
missing? Is my process making any sense to anyone but me?

Josh English
eng### [at] spiritonecom

Margus Ramst wrote:

> Andrew Cocker wrote in message <371b934a.0@news.povray.org>...
> >
> >Err, no, just a sphere scaled into an ellipse rolling along. I realise I
> was wrong
> >expecting to be able to rotate 180 degrees in 1 unit, and I should now use
> 3.141..., it's
> >the vertical position of the centre of the ellipse that I am still unclear
> about..how it
> >moves down and then back up whilst keeping in contact with the floor.
> Surely this value
> >will vary depending on the rotation, not the scale of the sphere. Forget
> that I mentioned
> >changing the scale mid-anim..if I can get this to work as is, then I'll be
> happy.
> >
>
> First, remember that the cirumference of an ellipse is not 2*pi*r. An
> approximation is 2*pi*sqrt[(a^2+b^2)/2] where a and b are lengths of major
> and minor axes.
>
> The other value you want - I haven't got right now. But why not just do
> this: use the Superpatch's trace() function; trace a line from the centre
> straight down. You can now get the radius for the current angle.
>
> Basically like this:
>
> #declare Ellipse=sphere{0,1 scale <.25,1,.25> rotate z*clock*360}
> #declare Rad=trace(Ellipse,0,-y).y;
>
> At least I think this should work.
>
> Margus


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.